package ooo.reindeer.concurrent.netqueue.message;

import ooo.reindeer.data.annotation.DynamicString;
import ooo.reindeer.data.annotation.LengthField;
import ooo.reindeer.data.annotation.UnsignedInt32;
import ooo.reindeer.data.annotation.UnsignedInt8;
import ooo.reindeer.data.option.Type;

@LengthField(value = "length", clazz = Head.class, revise = -4)
public class Head {
    @UnsignedInt32
    long length;

    @UnsignedInt8
    short command;
    @DynamicString(lengthFieldType = Type.UnsignedInt8)
    String topic;

    public short getCommand() {
        return command;
    }

    public void setCommand(short command) {
        this.command = command;
    }

    public String getTopic() {
        return topic;
    }

    public void setTopic(String topic) {
        this.topic = topic;
    }

    @Override
    public String toString() {
        return "Head{" +
                "command=" + command +
                ", topic='" + topic + '\'' +
                '}';
    }
}
